<template>
  <v-row justify="center" align="center">
    <v-col style="margin-top: 240px; max-width: 500px;" cols="12">
      <p>Better tomorrow</p>
      <div class="text-center">
        <v-text-field label="密码" v-model="password"></v-text-field>
      </div>
    </v-col>
    <v-col cols="12">
      <div class="text-center">
        <v-btn @click="handleClick">提交</v-btn>
      </div>
    </v-col>

    <v-col cols="12" style="margin-top: 32px; max-width: 500px;">
      <p>关注公众号回复 code 获取密码</p>
      <WxLogo />
    </v-col>
  </v-row>
</template>

<script>
import WxLogo from "~/components/VuetifyLogo";
import CryptoJS from "crypto-js";
export default {
  components: { WxLogo },
  data() {
    return {
      password: ""
    };
  },
  methods: {
    handleClick() {
      if (!this.password) {
        alert("密码错误");
        return;
      }
      const password = CryptoJS.MD5(this.password + "TEST").toString();
      if (password !== "a86621507078fb5c10d7de28ffc86e0a") {
        alert("密码错误");
        return;
      }

      this.$router.push("/detail?key=" + password);
    }
  }
};
</script>
